import 'package:flutter/cupertino.dart';
import 'package:json_annotation/json_annotation.dart';

part 'message_item_model.g.dart';

@JsonSerializable()
class THMessageItemModel {
  THMessageItemModel(
      {@required this.chatId,
      @required this.userId,
      @required this.userName,
      @required this.chatName,
      @required this.message,
      @required this.messageType,
      this.time,
      this.unReadCount = 0,
      this.isSingle = 0,
      this.avatar,
      this.isGroup = 0,
      this.groupAvatars,
      this.isDisturbing = 0,
      this.isSpecialAttention = 0,
      this.isAtYou = 0,
      this.isAtAll = 0,
      this.isStick = 0});

  /// 聊天 Id
  String chatId;

  /// 用户名称
  String userName;

  /// 用户Id
  String userId;

  /// 聊天名称
  String chatName;

  /// 消息体
  String message;

  /// message type
  int messageType;

  /// 时间
  int time;

  /// 未读数量
  int unReadCount;

  /// 单聊
  int isSingle;
  String avatar;

  /// 群聊信息
  int isGroup;
  String groupAvatars;

  /// 消息免打扰
  int isDisturbing;

  /// 是否为置顶
  int isStick;

  /// 特别关注
  int isSpecialAttention;

  /// 是否 @ 你
  int isAtYou;

  /// 是否 @ 全部
  int isAtAll;

  factory THMessageItemModel.fromJson(Map<String, dynamic> json) =>
      _$THMessageItemModelFromJson(json);

  Map<String, dynamic> toJson() => _$THMessageItemModelToJson(this);
}
